package com.young.controller;

import com.young.model.User;
import com.young.service.UserService;
import com.young.service.UserService2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
public class UserController {
	
    @Resource  
    private UserService userService;

    @Autowired
    private UserService2 userService2;
      
    @RequestMapping("/showUserInfo")    
    public ModelAndView getIndex(){      
        ModelAndView mav = new ModelAndView("index");   
        User user = userService.selectUserById(1);
        mav.addObject("user", user);   
        return mav;    
    }

    @RequestMapping("/showUserInfo2")
    public ModelAndView getIndex2(){
        ModelAndView mav = new ModelAndView("index");
        User user = userService2.selectUserById(1);
        mav.addObject("user", user);
        return mav;
    }
}
